package com.example.usercenter.once;

import com.alibaba.excel.EasyExcel;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class ImportExcel {
    public static void main(String[] args) {
        String fileName = "F:\\伙伴匹配系统\\back\\yupaopao-backend\\src\\main\\resources\\test.xlsx";
        //readByListener(fileName);
        synchronizRead(fileName);
    }
    private static void readByListener(String fileName) {

        EasyExcel.read(fileName, XingQiuTableUserInfo.class, new TableListener()).sheet().doRead();
    }
    private static void synchronizRead(String fileName) {

        List<XingQiuTableUserInfo> list = EasyExcel.read(fileName).head(XingQiuTableUserInfo.class).sheet().doReadSync();
        for (XingQiuTableUserInfo xingQiuTableUserInfo : list) {
            System.out.println(xingQiuTableUserInfo.getUsername());
        }
        System.out.println(list.size());
    }


}
